using System;
using UnityEngine;

public class Popup : MonoBehaviour
{
	public static Popup Pop;

	public PopUpInfo PopupObject;

	public PopUpPassword PopupPasswordObject;

	private Action callBack1Tmp;

	private Action callBack2Tmp;

	private void Awake()
	{
		Pop = this;
	}

	private void Start()
	{
		if ((bool)PopupObject)
		{
			PopupObject.gameObject.SetActive(value: false);
		}
		if ((bool)PopupPasswordObject)
		{
			PopupPasswordObject.gameObject.SetActive(value: false);
		}
	}

	public void Option1()
	{
		if (callBack1Tmp != null)
		{
			callBack1Tmp();
		}
		callBack1Tmp = null;
		callBack2Tmp = null;
	}

	public void Option2()
	{
		if (callBack2Tmp != null)
		{
			callBack2Tmp();
		}
		callBack1Tmp = null;
		callBack2Tmp = null;
	}

	public void ShowPopup(string text)
	{
		if ((bool)PopupObject)
		{
			PopupObject.gameObject.SetActive(value: true);
			PopupObject.ContentText.text = text;
		}
	}

	public void ShowPopupPassword()
	{
		UnityEngine.Debug.Log("Showpassword");
		if ((bool)PopupPasswordObject)
		{
			PopupPasswordObject.gameObject.SetActive(value: true);
		}
	}

	public void Asking(string header, Action callback1 = null, Action callback2 = null)
	{
		ShowPopup(header);
		callBack1Tmp = callback1;
		callBack2Tmp = callback2;
	}

	public void AskingPassword(string header, Action callback1 = null, Action callback2 = null)
	{
		ShowPopupPassword();
		callBack1Tmp = callback1;
		callBack2Tmp = callback2;
	}
}
